package supimpa.src;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import static org.lwjgl.opengl.GL11.*;

public class RenderManager {
	
	private Logger logger = Logger.getAnonymousLogger();

	public Map<String, Render> renderRegistry = new HashMap<String, Render>();
	public Map<String, Integer> dlRegistry = new HashMap<String, Integer>();
	public List<Class<? extends Block>> blockList = new ArrayList<Class<? extends Block>>();
	
	public Map<Class<? extends Block>, String> blockToRender = new HashMap<Class<? extends Block>, String>();
	
	public RenderManager(){
		
		register("block", CommonRenders.normalBlock);
		
		blockList.add(Block.class);
	}
	
	public Render getRender(Class<? extends Block> bloClass){
		
		return renderRegistry.get( blockToRender.get(bloClass) );
	}
	
	public void register(String s, Render r){

		logger.info("Registering render \""+s+"\" #"+r.getClass().getSimpleName());
		renderRegistry.put(s, r);
		r.init();
	}
}
